*------------------------------------------------------------------*
* "Why governments want to learn about citizens' perferences.
* Explaining the representational logic behind government polling."
* EJPR
* A. Durovic & T. Schnatterer
* 09/09/2024
*-------------------------------------------------------------------*


* Plan of the script 
* 1. FE Poisson panel regression (main model)
* 2. Robustness Check no 1
* 3. Robustness Check no 2
* 4. Robustness Check no 3
* 5. Robustness Check no 4
* 6. Robustness Check no 5
* 7. Robustness Check no 6
* 8. Robustness Check no 7
* 9. Robustness Check no 8



*====================================================================*
* 1. FE Poisson Panel Regression Models with Robust Standard Errors
*====================================================================*

* load data 
use "Replication1_GermanGovernmentPolls.dta", clear

*Declare data to be panel data
xtset pol_issues month

*Descriptive statistics
xtsum nbr_surveyquestions issue_own gov_priorities personal_sal cdu_csu_sal ///
EC3 EC2 gov_popularity time asylum covid19 GDP EU_elections3 media_sal 


*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m1

*IRR M1
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr

*Model 2  
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m2

*IRR M2
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m3

*IRR M3
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m4

*IRR M4
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr

*Model 5 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m5

*AME 
margins, at(gov_priorities=(.01(0.01).3)) dydx(personal_sal)
marginsplot, xtitle("Government Priorities", size(medium)) ///
xlabel(, labsize(small) angle(45)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

*IRR M5
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr

* Model 6   
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m6

*AME 
margins, at(EC3=(1 2 3)) dydx(personal_sal)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3m after election" 2"routine times" 3"3m before election", labsize(small) angle(45)) ///
ylabel(-2(1)8, labsize(medium small)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

*IRR M6 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr

* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m7

*AME 
margins, at(EC3=(1 2 3)) dydx(gov_priorities)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3m after election" 2"routine times" 3"3m before election", labsize(small) angle(45)) ///
ytitle("Average marginal effect of gov. priorities" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

*IRR M7
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust) irr



*Table no 1 .tex format 
esttab m1 m2 m3 m4 m5 m6 m7 using table_WP2a-paper_Reg_MainModels.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regression models\label{RegResults})
*----------------------------------------------------------------------*



*----------------------------------------------------------------------*
* Robustness Check no 1: 
* FE panel Poisson regression models with different operationalisation 
* of the electoral cycle (2months) and EU Elections (2months)
*----------------------------------------------------------------------*
*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m1

*Model 2  
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m2

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m3

*Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC2 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m4

*Model 5 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC2 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m5

*AME
margins, at(gov_priorities=(.01(0.01).3)) dydx(personal_sal)
marginsplot, xtitle("Government Priorities", size(medium)) ///
xlabel(, labsize(small) angle(45)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 6 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC2 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m6

*AME
margins, at(EC2=(1 2 3)) dydx(personal_sal)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "2m after election" 2"routine times" 3"2m before election", labsize(small) angle(45)) ///
ylabel(-2(1)10, labsize(medium small)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")


* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC2 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections2 c.media_sal,fe vce(robust)
estimates store r1_m7

*AME
margins, at(EC2=(1 2 3)) dydx(gov_priorities)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "2m after election" 2"routine times" 3"2m before election", labsize(small) angle(45)) ///
ytitle("Average marginal effect of gov. priorities" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

*Table .text format 
esttab r1_m1 r1_m2 r1_m3 r1_m4 r1_m5 r1_m6 r1_m7 using table_WP2apaper_Reg_Rob1.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions with 2month-based electoral cycle\label{R1_RegResults})
*-------------------------------------------------------------------------------



*------------------------------------------------------------------------------*
* Robustness Chek no 2 :
* Alternative operationalisation for public salience: results based on CDU-CSU
* salience measure
*------------------------------------------------------------------------------*
*Model 1  
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m1

*Model 2 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m2


*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.cdu_csu_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m3

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.cdu_csu_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m4

*Model 5 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.cdu_csu_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m5

* Model 6 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.cdu_csu_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m6

* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.cdu_csu_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r2_m7


*Table .tex format
esttab r2_m1 r2_m2 r2_m3 r2_m4 r2_m5 r2_m6 r2_m7 using table_WP2apaper_Reg_Rob2.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions models with CDU-CSU supporters'personal issue salience\label{R2_RegResults})
*-------------------------------------------------------------------------------


*------------------------------------------------------------------------------
* Robustness Check no 3:
* Alternative operationalisation for focusing events: results based on squared measures of asylum applications and C-19 hospital admissions.
*------------------------------------------------------------------------------
*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust) 
estimates store m1s

*Model 2 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust) 
estimates store m2s

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m3s

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m4s

*Model 5
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m5s

*Model 6
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m6s

*Model 7
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.sq_asylum c.sq_Covid19_hosp i.EU_elections3 c.media_sal,fe vce(robust)
estimates store m7s


* Table .tex format 
esttab m1s m2s m3s m4s m5s m6s m7s using table_WP2apaper_Reg_Rob3.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions with squared focusing events variable\label{R3_RegResults})
*-------------------------------------------------------------------------------*



*------------------------------------------------------------------------------
* Robustness Check no 4:
* Alternative operationalisation for Covid-19 pandemic: results based on a 
* measure of new Covid-19 infection cases per month
*------------------------------------------------------------------------------
*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r4_m1

*Model 2
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust) 
estimates store r4_m2

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r4_m3

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r4_m4

*Model 5  
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r4_m5

* Model 6  
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r4_m6

* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19_cases i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r4_m7


*Table .tex format
esttab r4_m1 r4_m2 r4_m3 r4_m4 r4_m5 r4_m6 r4_m7 using table_WP2apaper_Reg_Rob4.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions with lagged Covid-19 infection cases variable\label{R4_RegResults})
*-------------------------------------------------------------------------------



*------------------------------------------------------------------------------
* Robustness Check no 5:
* Alternative operationalisation for Covid-19 pandemic: results based on a 
* measure of new deaths caused by C-19 per month.
*------------------------------------------------------------------------------
*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r5_m1

*Model 2 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust) 
estimates store r5_m2

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r5_m3

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r5_m4

*Model 5  
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r5_m5

* Model 6 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r5_m6

* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19_deaths i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r5_m7


*Table .tex format 
esttab r5_m1 r5_m2 r5_m3 r5_m4 r5_m5 r5_m6 r5_m7 using table_WP2apaper_Reg_Rob5.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions with lagged Covid-19 death cases variable\label{R5_RegResults})
*--------------------------------------------------------------------------



*------------------------------------------------------------------------------
* Robustness Check no 6:
* Alternative data specifications: fixed effect panel Poisson regression models 
* without survey questions on health and immigration issues
*------------------------------------------------------------------------------

*Load data
use "Replication2_GermanGovernmentPolls.dta", clear

*panel structure
xtset 

*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m1_noih

*Model 2 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m2_noih

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m3_noih

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m4_noih

*Model 5 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m5_noih

* AME 
margins, at(gov_priorities=(.01(0.01).3)) dydx(personal_sal)
marginsplot, xtitle("Government Priorities", size(medium)) ///
xlabel(, labsize(small) angle(45)) ///
ylabel(-4(1)8, labsize(medium small)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 6 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m6_noih

*AME 
margins, at(EC3=(1 2 3)) dydx(personal_sal)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3 months after election" 2"routine times" 3"3 months before election", labsize(small) angle(45)) ///
ylabel(-6(1)8, labsize(medium small)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal_noih,fe vce(robust)
estimates store m7_noih

*AME
margins, at(EC3=(1 2 3)) dydx(gov_priorities)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3 months after election" 2"routine times" 3"3 months before election", labsize(small) angle(45)) ///
ytitle("Average marginal effect of gov. priorities" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")


**Table .tex format 
esttab m1_noih m2_noih m3_noih m4_noih m5_noih m6_noih m7_noih using table_WP2apaper_FEPoisson_noih_R6.tex, b(2) se(2) star(+ 0.10 * 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions models without surveys questions on health and immigration\label{R6_RegResults})
*-------------------------------------------------------------------------*






*-------------------------------------------------------------------------------
* Robustness Check no 7:
* Alternative model specifications: 
* results from FE panel Poisson regressions with interaction between CDU-CSU issue * ownership and government's priorities
*-------------------------------------------------------------------------------
* load data 
use "Replication1_GermanGovernmentPolls.dta", clear

*Declare data to be panel data
xtset pol_issues month

*Model 1 
xtpoisson nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m1

*Model 2  
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m2

*Model 3 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m3

* Model 4 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m4

*Model 5 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m5

*AME 
margins, at(gov_priorities=(.01(0.01).3)) dydx(personal_sal)
marginsplot, xtitle("Government Priorities", size(medium)) ///
xlabel(, labsize(small) angle(45)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 6   
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m6

*AME 
margins, at(EC3=(1 2 3)) dydx(personal_sal)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3m after election" 2"routine times" 3"3m before election", labsize(small) angle(45)) ///
ylabel(-2(1)8, labsize(medium small)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 7 
xtpoisson nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m7

*AME 
margins, at(EC3=(1 2 3)) dydx(gov_priorities)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3m after election" 2"routine times" 3"3m before election", labsize(small) angle(45)) ///
ytitle("Average marginal effect of gov. priorities" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 8 
xtpoisson nbr_surveyquestions i.issue_own##c.gov_priorities ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal,fe vce(robust)
estimates store r7_m8

*AME 
margins, at(issue_own=(1 0)) dydx(gov_priorities)
marginsplot, xtitle("CDU-CSU issues", size(medium)) ///
xlabel(0 "unowned issues" 1"CDU-CSU issues", labsize(small) angle(45)) ///
ytitle("Average marginal effect of gov. priorities" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

*Table .tex format 
esttab r7_m1 r7_m2 r7_m3 r7_m4 r7_m5 r7_m6 r7_m7 r7_m8 using table_WP2paper_Reg_Rob7.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(FE panel Poisson regressions\label{R7_RegResults})
*-----------------------------------------------------------------------------




*-------------------------------------------------------------------------------
* Robustness Check no 8:
* Alternative model specifications: 
* results from negative binomial regression models
*-------------------------------------------------------------------------------

*Load data
use "Replication1_GermanGovernmentPolls.dta", clear


*Model 1 - CDU issue ownership 
nbreg nbr_surveyquestions i.issue_own c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m1

*Model 2 - government's priorities
nbreg nbr_surveyquestions i.issue_own c.gov_priorities c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m2

*Model 3 - salience
nbreg nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m3

*Model 4 - electoral cycle 
nbreg nbr_surveyquestions i.issue_own c.gov_priorities c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m4

*Model 5 - interaction salience*RegProgram
nbreg nbr_surveyquestions i.issue_own c.gov_priorities##c.personal_sal ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m5

*AME 
margins, at(gov_priorities=(.01(0.01).3)) dydx(personal_sal)
marginsplot, xtitle("Government Priorities", size(medium)) ///
xlabel(, labsize(small) angle(45)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

*Model 6 
nbreg nbr_surveyquestions i.issue_own gov_priorities c.personal_sal##ib2.EC3 c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m6

*AME 
margins, at(EC3=(1 2 3)) dydx(personal_sal)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3m after election" 2"routine times" 3"3m before election", labsize(small) angle(45)) ///
ytitle("Average marginal effect of salience" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")

* Model 7  
nbreg nbr_surveyquestions i.issue_own c.gov_priorities##ib2.EC3 c.personal_sal c.gov_popularity c.time c.GDP c.asylum c.covid19 i.EU_elections3 c.media_sal ib2.pol_issues, vce(robust)
estimates store r8_m7

*AME  
margins, at(EC3=(1 2 3)) dydx(gov_priorities)
marginsplot, xtitle("Electoral cycle", size(medium)) ///
xlabel(1 "3m after election" 2"routine times" 3"3m before election", labsize(small) angle(45)) ///
ytitle("Average marginal effect of gov. priorities" "on the number of questions", size(medium small)) ///
yline(0, lstyle(foreground)) ///
title("")



*Table .tex format 
esttab r8_m1 r8_m2 r8_m3 r8_m4 r8_m5 r8_m6 r8_m7 using table_WP2paperNBReg_Rob8.tex, b(2) se(2) star(* 0.05 ** 0.01 *** 0.001) pr2 nobaselevels nogaps replace ///
title(Negative Binomial regression models with issue fixed effects\label{R8_RegResults})
*-----------------------------------------------------------------------------



*End of analyses
clear all
exit 
